load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("sapling")

# the library itself
rust_library(
    name = "xdiff-sys",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_config": {
        "extra_buck_dependencies": {"build-dependencies": ["fbsource//third-party/rust:cc"]},
        "lib": {"name": "xdiff-sys"},
        "package": {
            "authors": ["Meta Source Control Team <sourcecontrol-dev@meta.com>"],
            "homepage": "https://sapling-scm.com/",
            "license": "MIT",
            "name": "sapling-xdiff-sys",
            "repository": "https://github.com/facebook/sapling",
        },
    }},
    crate_root = "src/lib.rs",
    deps = ["//eden/scm/lib/third-party/xdiff:xdiff"],
)

# small demo binary using the bindings
rust_binary(
    name = "xdiff-sys-bin",
    srcs = ["src/bin/xdiff-sys-bin.rs"],
    crate_root = "src/bin/xdiff-sys-bin.rs",
    deps = [":xdiff-sys"],
)
